package views.activity.curriculum;

import java.awt.Font;

import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTable;
import javax.swing.JTextField;
import javax.swing.border.EmptyBorder;
import javax.swing.table.DefaultTableModel;

public class CurriculumParticipants extends JFrame {

	private JPanel contentPane;
	
	public JTextField txtName;
	public JTextField txtDegree;
	public JTextField txtSection;
	public JTable tblParticipants;
	public DefaultTableModel tblModelParticipants;
	public JButton btnAdd;
	public JButton btnRemoveParticipant;
	public JButton btnChangeGrade;
	public JButton btnCancel;
	public JButton btnSave;
	
	public CurriculumParticipants() {
		this.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
		this.setBounds(100, 100, 450, 450);
		this.setVisible(true);
		this.setResizable(false);
		
		contentPane = new JPanel();
		contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
		contentPane.setLayout(null);
		this.setContentPane(contentPane);
		
		JPanel panel = new JPanel();
		panel.setBounds(10, 10, 424, 400);
		panel.setLayout(null);
		contentPane.add(panel);
		
		JLabel lblCurriculumParticipants = new JLabel("Curriculum Participants");
		lblCurriculumParticipants.setFont(new Font("Arial", Font.PLAIN, 12));
		lblCurriculumParticipants.setBounds(10, 10, 404, 20);
		panel.add(lblCurriculumParticipants);
		
		JLabel lblName = new JLabel("Name");
		lblName.setFont(new Font("Arial", Font.PLAIN, 12));
		lblName.setBounds(10, 40, 150, 20);
		panel.add(lblName);
		
		JLabel lblDegree = new JLabel("Degree");
		lblDegree.setFont(new Font("Arial", Font.PLAIN, 12));
		lblDegree.setBounds(170, 40, 80, 20);
		panel.add(lblDegree);
		
		JLabel lblSection = new JLabel("Section");
		lblSection.setFont(new Font("Arial", Font.PLAIN, 12));
		lblSection.setBounds(260, 40, 50, 20);
		panel.add(lblSection);
		
		JScrollPane scrollPane = new JScrollPane();
		scrollPane.setBounds(10, 125, 404, 230);
		panel.add(scrollPane);
		
		txtName = new JTextField();
		txtName.setFont(new Font("Arial", Font.PLAIN, 12));
		txtName.setBounds(10, 60, 150, 20);
		panel.add(txtName);
		txtName.setColumns(10);
		
		txtDegree = new JTextField();
		txtDegree.setFont(new Font("Arial", Font.PLAIN, 12));
		txtDegree.setColumns(10);
		txtDegree.setBounds(170, 60, 80, 20);
		panel.add(txtDegree);
		
		txtSection = new JTextField();
		txtSection.setFont(new Font("Arial", Font.PLAIN, 12));
		txtSection.setColumns(10);
		txtSection.setBounds(260, 60, 50, 20);
		panel.add(txtSection);
		
		tblModelParticipants = new DefaultTableModel( new Object[][] {}, new String[] { "Name",
																						"Degree",
																						"Section",
																						"Grade" } );
		
		tblParticipants = new JTable( tblModelParticipants );
		scrollPane.setViewportView(tblParticipants);
		tblParticipants.getColumnModel().getColumn( 0 ).setPreferredWidth( 200 );
		tblParticipants.getColumnModel().getColumn( 1 ).setPreferredWidth( 100 );
		tblParticipants.getColumnModel().getColumn( 2 ).setPreferredWidth( 50 ); //TODO
		
		btnAdd = new JButton("Add");
		btnAdd.setFont(new Font("Arial", Font.PLAIN, 12));
		btnAdd.setBounds(320, 55, 94, 25);
		panel.add(btnAdd);
		
		btnSave = new JButton("Save");
		btnSave.setFont(new Font("Arial", Font.PLAIN, 12));
		btnSave.setBounds(314, 364, 100, 25);
		panel.add(btnSave);
		
		btnCancel = new JButton("Cancel");
		btnCancel.setFont(new Font("Arial", Font.PLAIN, 12));
		btnCancel.setBounds(10, 365, 100, 25);
		panel.add(btnCancel);
		
		btnRemoveParticipant = new JButton("Remove from List");
		btnRemoveParticipant.setFont(new Font("Arial", Font.PLAIN, 12));
		btnRemoveParticipant.setBounds(10, 90, 129, 25);
		panel.add(btnRemoveParticipant);
		
		btnChangeGrade = new JButton("Change Grade");
		btnChangeGrade.setFont(new Font("Arial", Font.PLAIN, 12));
		btnChangeGrade.setBounds(149, 90, 129, 25);
		panel.add(btnChangeGrade);
	}
}
